<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="s" uri="/struts-tags" %>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <base href="<%=basePath%>">
    
    <title>启动评审流程</title>
    
	<meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="cache-control" content="no-cache">
	<meta http-equiv="expires" content="0">    
	<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
	<meta http-equiv="description" content="This is my page">
	<!--
	<link rel="stylesheet" type="text/css" href="styles.css">
	-->
	<link rel="stylesheet" type="text/css" href="css/styles.css">
  </head>
  <body>
  <div>
    	<fieldset style="text-align:center">
    	<legend>初始化流程引擎</legend>
    	<s:form theme="simple" action="startArticleFlowAction" enctype="multipart/form-data" method="post">
    	<s:label>请选择上传的流程文件(zip格式):</s:label>
    	<s:file name="file" cssStyle="margin-top:10px;margin-left:20px"></s:file><br/>
    	<input type="submit" value="提交" style="margin-top:10px;height:20px"/>
    	<input type="reset" value="重置" style="margin-left:30px;height:20px"/>
    	</s:form>
    	</fieldset>
    </div>
    <div>
    	<fieldset>
    	<legend>启动流程引擎</legend>
    <div style="text-align:center">
    	   <table border="1">
    	  		<tr>
    	  			<th>流程ID</th>
    	  			<th>流程Key</th>
    	  			<th>流程名</th>
    	  			<th>版本</th>
    	  			<th>部署ID</th>
    	  			<th>操作</th>
    	  		</tr>
    	  		<c:choose>
    	  		<c:when test="${empty pdList}">
    	  		 <tr>
    	  		 	<td colspan="6">没有相关流程定义</td>
    	  		 </tr>	
    	  		</c:when>
    	  		<c:otherwise>
    	  		<c:forEach items="${pdList}" var="pdList">
    	  			<tr onmouseover="this.className='mouseOver'" onmouseout="this.className='mouseOut'">
    	  				<td>${pdList.id}</td>
    	  				<td>${pdList.key}</td>
    	  				<td>${pdList.name}</td>
    	  				<td>${pdList.version}</td>
    	  				<td>${pdList.deploymentId}</td>
    	  				<td>
    	  					<a href="pdOperationAction.action?type=start&id=${pdList.id}">启动</a><span style="color:#7C7CC6;margin-left:5px;margin-right:5px">|</span>
    	  					<a href="pdOperationAction.action?type=delete&id=${pdList.deploymentId}">删除</a>
    	  				</td>
    	  			</tr>
    	  		</c:forEach>
    	  			</c:otherwise>
    	  		</c:choose>
    	   		<tr>
    	   		</tr>
    	   </table>
    	  </div>  
    	</fieldset>
    </div>
     <div>
    <fieldset>
    	<legend>执行中的审批流程</legend>
    <div style="text-align:center">
    	   <table border="1">
    	  		<tr>
    	  			<th>流程ID</th>
    	  			<!-- <th>流程Key</th>
    	  			<th>流程名</th> -->
    	  			<th>状态</th>
    	  			<th>流程实例ID</th>
    	  			<th>操作</th>
    	  		</tr>
    	  		<c:choose>
    	  		<c:when test="${empty piList}">
    	  		 <tr>
    	  		 	<td colspan="6">没有相关审批流程</td>
    	  		 </tr>	
    	  		</c:when>
    	  		<c:otherwise>
    	  		<c:forEach items="${piList}" var="piList">
    	  			<tr onmouseover="this.className='mouseOver'" onmouseout="this.className='mouseOut'">
    	  				<td>${piList.id}</td>
    	  			<!-- 	<td>${piList.key}</td> 
    	  				<td>${piList.name}</td>-->
    	  				<td>${piList.state}</td>
    	  				<td>${piList.processDefinitionId}</td>
    	  				<td>
    	  					<a href="pdOperationAction.action?type=end&id=${piList.id}">结束流程</a>
    	  				</td>
    	  			</tr>
    	  		</c:forEach>
    	  			</c:otherwise>
    	  		</c:choose>
    	   		<tr>
    	   		</tr>
    	   </table>
    	  </div>  
    	</fieldset>
    </div>
  </body>
</html>
